package com.yunc.base;

import com.yunc.modules.sys.service.ISysDictDataService;
import com.yunc.modules.sys.service.ISysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
public class ApplicationRunnerPreload implements ApplicationRunner {

    @Autowired
    private ISysDictDataService sysDictDataService;
    @Autowired
    private ISysMenuService sysMenuService;

    @Override
    public void run(ApplicationArguments args) {
        // 提前加载字典码
        sysDictDataService.listAll();
        // 加载所有菜单
        sysMenuService.queryMenuTreeList();
        sysMenuService.queryMenuList();
    }
}
